package com.develrage.prinance.soapws;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDatatypeConverter
{
    // unmarshal
    public static Date myParseDate(String v)
    {
	SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd");
	try
	{
	    return simple.parse(v);
	} catch (ParseException e)
	{
	    System.out.println("Failed to convert XML-String to Date");
	    e.printStackTrace();
	    return null;
	}
    }

    // marshal
    public static String myPrintDate(Date v)
    {
	if (v == null) {
            return null;
        }
	SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd");
	return simple.format(v);
    }

    
}
